
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>快速使用 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="函数及常量.html" />
    
    
    <link rel="prev" href="./" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2" data-path="快速使用.html">
            
                <a href="快速使用.html">
            
                    
                    快速使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="函数及常量.html">
            
                <a href="函数及常量.html">
            
                    
                    函数及常量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="BARRA因子.html">
            
                <a href="BARRA因子.html">
            
                    
                    因子计算
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="已支持的表.html">
            
                <a href="已支持的表.html">
            
                    
                    已支持的表
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="balance_sheet.html">
            
                <a href="balance_sheet.html">
            
                    
                    balance_sheet
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="deriv_finance_indicator.html">
            
                <a href="deriv_finance_indicator.html">
            
                    
                    deriv_finance_indicator
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="fundamentals_balance.html">
            
                <a href="fundamentals_balance.html">
            
                    
                    fundamentals_balance
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="fundamentals_cashflow.html">
            
                <a href="fundamentals_cashflow.html">
            
                    
                    fundamentals_cashflow
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="fundamentals_income.html">
            
                <a href="fundamentals_income.html">
            
                    
                    fundamentals_income
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="share_change.html">
            
                <a href="share_change.html">
            
                    
                    share_change
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="trading_derivative_indicator.html">
            
                <a href="trading_derivative_indicator.html">
            
                    
                    trading_derivative_indicator
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="项目说明.html">
            
                <a href="项目说明.html">
            
                    
                    项目说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    参与项目开发
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="参与项目开发/添加函数.html">
            
                <a href="参与项目开发/添加函数.html">
            
                    
                    添加函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="参与项目开发/添加数据表.html">
            
                <a href="参与项目开发/添加数据表.html">
            
                    
                    添加数据表
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >快速使用</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x914D;&#x7F6E;&#x6570;&#x636E;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;">&#x914D;&#x7F6E;&#x6570;&#x636E;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;</h2>
<p>&#x672C;&#x9879;&#x76EE;&#x9700;&#x4F9D;&#x8D56;&#x4E00;&#x4E9B;&#x672C;&#x5730;&#x6570;&#x636E;&#x6587;&#x4EF6;&#xFF0C;&#x4E0B;&#x8F7D;&#x5230;&#x672C;&#x5730;&#x540E;&#xFF0C;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;&#x5373;&#x53EF;&#x4F7F;&#x7528;&#xFF0C;&#x5176;&#x4E2D;<code>dataFile</code> &#x548C; <code>Fut_Data</code>&#x5747;&#x6570;&#x636E;&#x50A8;&#x5B58;&#x8DEF;&#x5F84;</p>
<p>&#x4E8E;<code>Utils.py</code>&#x4E2D;&#x914D;&#x7F6E;<code>dataBase_root_path</code>&#x548C;<code>dataBase_root_path_future</code>&#x5373;&#x53EF;&#xFF0C;&#x5177;&#x4F53;&#x4E3A;</p>
<ul>
<li>&#x80A1;&#x7968;&#x6570;&#x636E;&#x8DEF;&#x5F84;</li>
</ul>
<pre><code class="lang-python">dataBase_root_path = <span class="hljs-string">r&apos;D:\Share\Euclid_work\dataFile&apos;</span>  <span class="hljs-comment"># &#x5F00;&#x53D1;&#x73AF;&#x5883;</span>
dataBase_root_path = <span class="hljs-string">r&apos;E\share\Stk_Data\dataFile&apos;</span>  <span class="hljs-comment"># &#x4F7F;&#x7528;&#x73AF;&#x5883;</span>
</code></pre>
<ul>
<li>&#x671F;&#x8D27;&#x6570;&#x636E;&#x8DEF;&#x5F84;</li>
</ul>
<pre><code class="lang-python">dataBase_root_path_future = <span class="hljs-string">r&quot;D:\Share\Fut_Data&quot;</span>  <span class="hljs-comment"># &#x5F00;&#x53D1;&#x73AF;&#x5883;</span>
dataBase_root_path_future = <span class="hljs-string">r&quot;E:\Share\Fut_Data&quot;</span>  <span class="hljs-comment"># &#x4F7F;&#x7528;&#x73AF;&#x5883;</span>
</code></pre>
<h2 id="&#x4F7F;&#x7528;getdata&#x8C03;&#x7528;&#x6570;&#x636E;">&#x4F7F;&#x7528;get_data&#x8C03;&#x7528;&#x6570;&#x636E;</h2>
<p>&#x7531;Quant_Share&#x6A21;&#x5757;&#x5BFC;&#x5165;get_data&#x51FD;&#x6570;&#x540E;&#xFF0C;&#x5373;&#x53EF;&#x4F7F;&#x7528;get_data&#x8FDB;&#x884C;&#x6570;&#x636E;&#x8C03;&#x7528;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> Quant_Share <span class="hljs-keyword">import</span> get_data  <span class="hljs-comment"># &#x63A8;&#x8350;&#x4F7F;&#x7528;&#xFF0C;&#x7528;&#x4EC0;&#x4E48;&#x5BFC;&#x5165;&#x4EC0;&#x4E48;</span>
form Quant_Share <span class="hljs-keyword">import</span> *  <span class="hljs-comment"># &#x4E0D;&#x63A8;&#x8350;&#x4F7F;&#x7528;&#xFF0C;&#x4E00;&#x80A1;&#x8111;&#x5168;&#x90E8;&#x5BFC;&#x5165;</span>
</code></pre>
<h3 id="&#x4F7F;&#x7528;getdata&#x83B7;&#x53D6;&#x80A1;&#x7968;&#x6570;&#x636E;">&#x4F7F;&#x7528;get_data&#x83B7;&#x53D6;&#x80A1;&#x7968;&#x6570;&#x636E;</h3>
<p><code>get_data_stock(tableName, begin, end, fields, ticker)</code></p>
<ul>
<li>tableName&#xFF1A;&#x6570;&#x636E;&#x8868;&#x540D;&#xFF0C;&#x8BF7;&#x67E5;&#x770B;<a href="https://gitee.com/Euclid-Jie/Quant_Share/wikis/&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868;" target="_blank">&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868; </a>&#x6216;&#x6253;&#x5370;<code>tableInfo.keys()</code>&#x67E5;&#x770B;&#xFF0C;(<code>tableInfo</code>&#x4E3A;<code>Quant_Share</code>&#x4E2D;&#x7684;&#x5E38;&#x91CF;)</li>
<li>begin&#xFF1A;&#x6570;&#x636E;&#x5F00;&#x59CB;&#x65F6;&#x95F4;&#xFF0C;&#x6839;&#x636E;date_column&#x8FDB;&#x884C;&#x7B5B;&#x9009;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;<code>20150101</code>&#xFF0C;date_column&#x8BE6;&#x89C1;<a href="https://gitee.com/Euclid-Jie/Quant_Share/wikis/&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868;" target="_blank">&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868; </a></li>
<li>end&#xFF1A;&#x6570;&#x636E;&#x7ED3;&#x675F;&#x65F6;&#x95F4;&#xFF0C;&#x6839;&#x636E;date_columns&#x8FDB;&#x884C;&#x7B5B;&#x9009;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;&#x4ECA;&#x5929;</li>
<li>fields&#xFF1A;&#x9700;&#x8981;&#x7684;&#x5217;&#x540D;&#xFF0C;&#x4F20;&#x5165;&#x683C;&#x5F0F;&#x4E3A;<code>list</code>&#xFF0C;&#x4E0D;&#x586B;&#x5219;&#x8F93;&#x51FA;&#x5168;&#x90E8;</li>
<li>ticker&#xFF1A;&#x9700;&#x8981;&#x7684;<code>tickerNum</code>&#xFF0C;&#x4F20;&#x5165;&#x683C;&#x5F0F;&#x4E3A;<code>list</code>&#xFF0C;&#x6839;&#x636E;<code>ticker_column</code>&#x8FDB;&#x884C;&#x7B5B;&#x9009;&#xFF0C;&#x4E0D;&#x586B;&#x5219;&#x8F93;&#x51FA;&#x5168;&#x90E8;</li>
</ul>
<p>&#x5EFA;&#x8BAE;&#x9996;&#x6B21;&#x4F7F;&#x7528;&#x8868;&#x65F6;&#xFF0C;&#x4EC5;&#x6307;&#x5B9A;&#x65F6;&#x95F4;&#x8DE8;&#x5EA6;&#x3002;&#x4EE5;&#x4E0B;&#x4E3A;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> Quant_Share <span class="hljs-keyword">import</span> get_data
data = get_data(<span class="hljs-string">&apos;bench_price&apos;</span>, begin=<span class="hljs-string">&apos;20160101&apos;</span>, end=<span class="hljs-keyword">None</span>)
print(data.info())
</code></pre>
<h3 id="&#x4F7F;&#x7528;getdata&#x83B7;&#x53D6;&#x671F;&#x8D27;&#x6570;&#x636E;">&#x4F7F;&#x7528;get_data&#x83B7;&#x53D6;&#x671F;&#x8D27;&#x6570;&#x636E;</h3>
<p><code>get_data_future(tableName, begin, end, sources=&apos;gm&apos;, fields, ticker)</code></p>
<ul>
<li>tableName&#xFF1A;&#x6570;&#x636E;&#x8868;&#x540D;&#xFF0C;&#x8BF7;&#x67E5;&#x770B;<a href="https://gitee.com/Euclid-Jie/Quant_Share/wikis/&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868;" target="_blank">&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868; </a>&#x6216;&#x6253;&#x5370;<code>tableInfo.keys()</code>&#x67E5;&#x770B;&#xFF0C;(<code>tableInfo</code>&#x4E3A;<code>Quant_Share</code>&#x4E2D;&#x7684;&#x5E38;&#x91CF;)</li>
<li>begin&#xFF1A;&#x6570;&#x636E;&#x5F00;&#x59CB;&#x65F6;&#x95F4;&#xFF0C;&#x6839;&#x636E;date_column&#x8FDB;&#x884C;&#x7B5B;&#x9009;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;<code>20150101</code>&#xFF0C;date_column&#x8BE6;&#x89C1;<a href="https://gitee.com/Euclid-Jie/Quant_Share/wikis/&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868;" target="_blank">&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868; </a></li>
<li>end&#xFF1A;&#x6570;&#x636E;&#x7ED3;&#x675F;&#x65F6;&#x95F4;&#xFF0C;&#x6839;&#x636E;date_columns&#x8FDB;&#x884C;&#x7B5B;&#x9009;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;&#x4ECA;&#x5929;</li>
<li>source&#xFF1A;&#x6570;&#x636E;&#x6E90;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A;gm&#xFF0C;&#x53E6;&#x6709;qe&#x53EF;&#x9009;</li>
<li>fields&#xFF1A;&#x9700;&#x8981;&#x7684;&#x5217;&#x540D;&#xFF0C;&#x4F20;&#x5165;&#x683C;&#x5F0F;&#x4E3A;<code>list</code>&#xFF0C;&#x4E0D;&#x586B;&#x5219;&#x8F93;&#x51FA;&#x5168;&#x90E8;</li>
<li>ticker&#xFF1A;&#x9700;&#x8981;&#x7684;&#x671F;&#x8D27;&#x4EE3;&#x7801;&#xFF0C;&#x8BE6;&#x89C1;<code>futures_list</code>&#xFF0C;&#x4F20;&#x5165;&#x683C;&#x5F0F;&#x4E3A;<code>list</code>&#xFF0C;&#x6839;&#x636E;<code>ticker_column</code>&#x8FDB;&#x884C;&#x7B5B;&#x9009;&#xFF0C;&#x4E0D;&#x586B;&#x5219;&#x8F93;&#x51FA;&#x5168;&#x90E8;</li>
</ul>
<p>&#x5EFA;&#x8BAE;&#x9996;&#x6B21;&#x4F7F;&#x7528;&#x8868;&#x65F6;&#xFF0C;&#x4EC5;&#x6307;&#x5B9A;&#x65F6;&#x95F4;&#x8DE8;&#x5EA6;&#x3002;&#x4EE5;&#x4E0B;&#x4E3A;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> Quant_Share <span class="hljs-keyword">import</span> get_data, futures_list
<span class="hljs-comment"># print(futures_list)</span>
data = get_data(<span class="hljs-string">&apos;Price_Volume_Data/main&apos;</span>, begin=<span class="hljs-string">&apos;20160101&apos;</span>, end=<span class="hljs-keyword">None</span>)
print(data.info())
</code></pre>
<h3 id="&#x4F7F;&#x7528;getdata&#x83B7;&#x53D6;info&#x8868;">&#x4F7F;&#x7528;get_data&#x83B7;&#x53D6;Info&#x8868;</h3>
<p><code>bench_info</code>&#x3001;<code>stock_info</code>&#x3001;<code>tradeDate_info</code>&#x5DF2;&#x4F5C;&#x4E3A;<code>Quant_Share</code>&#x4E2D;&#x7684;&#x5E38;&#x91CF;&#xFF0C;&#x4F7F;&#x7528;<code>from Quant_share import *</code>&#x65F6;&#xFF0C;&#x9ED8;&#x8BA4;&#x88AB;&#x5BFC;&#x5165;</p>
<p>&#x53E6;&#x6709;&#x5982;&#x4E0B;<code>Info</code>&#x8868;&#x53EF;&#x4F7F;&#x7528;<code>get_data(InfoName)</code>&#x76F4;&#x63A5;&#x5BFC;&#x5165;</p>
<ul>
<li><code>SecID_info</code>&#xFF1A;&#x901A;&#x8054;&#x80A1;&#x7968;&#x57FA;&#x672C;&#x4FE1;&#x606F;</li>
<li><code>IndustryID_info</code>&#xFF1A;&#x901A;&#x8054;&#x884C;&#x4E1A;&#x884C;&#x4E1A;&#x5206;&#x7C7B;&#x6807;&#x51C6;</li>
<li><code>SysCode_info</code>&#xFF1A;&#x901A;&#x8054;&#x53C2;&#x6570;&#x5E38;&#x91CF;&#x503C;&#x96C6;&#x5408;</li>
<li><code>PartyID_info</code>&#xFF1A;&#x901A;&#x8054;&#x516C;&#x53F8;&#x57FA;&#x672C;&#x4FE1;&#x606F;</li>
</ul>
<h3 id="&#x5DF2;&#x652F;&#x6301;&#x5BFC;&#x5165;&#x7684;&#x8868;">&#x5DF2;&#x652F;&#x6301;&#x5BFC;&#x5165;&#x7684;&#x8868;</h3>
<p>&#x6700;&#x65B0;&#x66F4;&#x65B0;&#x8BF7;&#x67E5;&#x770B;<a href="https://gitee.com/Euclid-Jie/Quant_Share/wikis/&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868;" target="_blank">&#x5DF2;&#x652F;&#x6301;&#x7684;&#x8868; </a></p>
<h2 id="&#x4F7F;&#x7528;&#x56DE;&#x6D4B;">&#x4F7F;&#x7528;&#x56DE;&#x6D4B;</h2>
<p>&#x4E0B;&#x9762;&#x5C55;&#x793A;&#x4E00;&#x4E2A;&#x5916;&#x7F6E;&#x6301;&#x80A1;5&#x65E5;&#x53D8;&#x52A8;&#x56E0;&#x5B50;&#x7684;&#x8BA1;&#x7B97;&#x3001;&#x56DE;&#x6D4B;&#x8FC7;&#x7A0B;</p>
<h3 id="&#x8C03;&#x7528;&#x6570;&#x636E;&#x8BA1;&#x7B97;&#x56E0;&#x5B50;">&#x8C03;&#x7528;&#x6570;&#x636E;&#x8BA1;&#x7B97;&#x56E0;&#x5B50;</h3>
<p>&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;<code>Score</code>&#x9700;&#x4E3A;&#x5BBD;&#x8868;&#x683C;&#x5F0F;(<code>index</code>&#x4E3A;&#x65E5;&#x671F;&#xFF0C;<code>column</code>&#x4E3A;<code>stockNum</code>)&#xFF0C;&#x5E76;&#x9700;&#x4F20;&#x5165;<code>reindex</code>&#x5BF9;&#x5BBD;&#x8868;&#x8FDB;&#x884C;&#x6807;&#x51C6;&#x5316;</p>
<p><code>info_lag</code>&#x662F;&#x5C06;&#x65E5;&#x671F;&#x6EDE;&#x540E;&#x4E00;&#x5929;&#xFF0C;&#x5373;&#x5728;&#x540E;&#x4E00;&#x4E2A;&#x4EA4;&#x6613;&#x65E5;&#x624D;&#x80FD;&#x83B7;&#x53D6;&#x6B64;&#x56E0;&#x5B50;&#x6570;&#x636E;&#xFF0C;&#x4E25;&#x7981;&#x4F7F;&#x7528;&#x672A;&#x6765;&#x4FE1;&#x606F;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> Utils <span class="hljs-keyword">import</span> *

<span class="hljs-comment"># score prepare</span>
data = get_data(<span class="hljs-string">&apos;HKshszHold&apos;</span>, begin=<span class="hljs-string">&apos;20200101&apos;</span>, end=<span class="hljs-string">&apos;20221231&apos;</span>)
data = data.pivot(index=<span class="hljs-string">&apos;endDate&apos;</span>, columns=<span class="hljs-string">&apos;ticker&apos;</span>, values=<span class="hljs-string">&apos;partyPct&apos;</span>)
data = reindex(data.pct_change(periods=<span class="hljs-number">5</span>, axis=<span class="hljs-number">0</span>))
score = info_lag(data2score(data), n_lag=<span class="hljs-number">1</span>)  <span class="hljs-comment"># do not use future info</span>
</code></pre>
<h3 id="&#x51C6;&#x5907;&#x56DE;&#x6D4B;&#x57FA;&#x7840;&#x6570;&#x636E;">&#x51C6;&#x5907;&#x56DE;&#x6D4B;&#x57FA;&#x7840;&#x6570;&#x636E;</h3>
<p>&#x51C6;&#x5907;&#x80A1;&#x7968;&#x7684;&#x65E5;&#x6536;&#x76CA;&#x7387;&#xFF0C;<code>ST</code>&#x72B6;&#x51B5;&#x3001;&#x9650;&#x4EF7;&#x4FE1;&#x606F;&#x7B49;</p>
<pre><code class="lang-python"><span class="hljs-comment"># group beck data prepare</span>
DataClass = DataPrepare(beginDate=<span class="hljs-string">&apos;20200101&apos;</span>, endDate=<span class="hljs-string">&apos;20221231&apos;</span>)
DataClass.get_Tushare_data()
</code></pre>
<h3 id="&#x4F7F;&#x7528;&#x56E0;&#x5B50;score&#x8FDB;&#x884C;&#x5206;&#x7EC4;&#x56DE;&#x6D4B;">&#x4F7F;&#x7528;&#x56E0;&#x5B50;<code>Score</code>&#x8FDB;&#x884C;&#x5206;&#x7EC4;&#x56DE;&#x6D4B;</h3>
<pre><code class="lang-python"><span class="hljs-comment"># group beck test</span>
BTClass = simpleBT(DataClass.TICKER, DataClass.BENCH)
fig, outMetrics, group_res = BTClass.groupBT(score)
fig.show()  <span class="hljs-comment"># &#x7ED8;&#x56FE;</span>
print(outMetrics)  <span class="hljs-comment"># &#x8F93;&#x51FA;&#x6307;&#x6807;</span>
</code></pre>
<h3 id="&#x56DE;&#x6D4B;&#x7ED3;&#x679C;&#x5C55;&#x793A;">&#x56DE;&#x6D4B;&#x7ED3;&#x679C;&#x5C55;&#x793A;</h3>
<p>&#x4E94;&#x7EC4;&#x7684;&#x8D85;&#x989D;&#x51C0;&#x503C;<code>alpha_Nav</code>&#x66F2;&#x7EBF;&#x56FE;</p>
<p><img src="https://euclid-picgo.oss-cn-shenzhen.aliyuncs.com/image/202304141126903.png" alt="&#x5206;&#x7EC4;&#x56DE;&#x6D4B;&#x8D85;&#x989D;&#x7ED3;&#x679C;"></p>
<h3 id="&#x56DE;&#x6D4B;&#x6307;&#x6807;&#x8BF4;&#x660E;">&#x56DE;&#x6D4B;&#x6307;&#x6807;&#x8BF4;&#x660E;</h3>
<table>
<thead>
<tr>
<th>Metric</th>
<th>description</th>
<th>Calc Method</th>
</tr>
</thead>
<tbody>
<tr>
<td>group</td>
<td>&#x7EC4;&#x522B;</td>
<td><code>Score</code>&#x8D8A;&#x5927;&#xFF0C;&#x7EC4;&#x522B;&#x6570;&#x8D8A;&#x5C0F;</td>
</tr>
<tr>
<td>totalrtn</td>
<td>&#x603B;&#x8D85;&#x989D;&#x6536;&#x76CA;</td>
<td>&#x56DE;&#x6D4B;&#x533A;&#x95F4;&#x5185;&#x7684;&#x603B;&#x8D85;&#x989D;&#x6536;&#x76CA;&#xFF0C;<code>nav[-1] - nav[0]</code>&#x5F97;&#x5230;</td>
</tr>
<tr>
<td>alzdrtn</td>
<td>&#x5E74;&#x5316;&#x8D85;&#x989D;&#x6536;&#x76CA;</td>
<td>&#x6839;&#x636E;&#x56DE;&#x6D4B;&#x533A;&#x95F4;&#x8FDB;&#x884C;&#x8C03;&#x6574;&#xFF0C;&#x8BA1;&#x7B97;&#x65B9;&#x5F0F;<code>(totalrtn+1)^(1/years)-1</code></td>
</tr>
<tr>
<td>stdev</td>
<td>&#x603B;&#x6807;&#x51C6;&#x5DEE;</td>
<td>&#x8D85;&#x989D;&#x66F2;&#x7EBF;&#x7684;&#x6807;&#x51C6;&#x5DEE;</td>
</tr>
<tr>
<td>vol</td>
<td>&#x5E74;&#x5316;&#x6CE2;&#x52A8;</td>
<td>&#x6839;&#x636E;<code>stdev*std(250)</code>&#x5F97;&#x5230;</td>
</tr>
<tr>
<td>sharpe</td>
<td>&#x590F;&#x666E;&#x6BD4;&#x4F8B;</td>
<td>&#x6839;&#x636E;<code>alzdrtn/vol</code>&#x5F97;&#x5230;</td>
</tr>
<tr>
<td>maxdown</td>
<td>&#x6700;&#x5927;&#x56DE;&#x6D4B;</td>
<td>&#x4E13;&#x4E1A;&#x672F;&#x8BED;&#xFF0C;&#x4E0D;&#x591A;&#x89E3;&#x91CA;</td>
</tr>
<tr>
<td>turnover</td>
<td>&#x6362;&#x624B;&#x7387;</td>
<td>&#x56DE;&#x6D4B;&#x533A;&#x95F4;&#x5185;&#x7684;&#x5E73;&#x5747;&#x6BCF;&#x65E5;&#x6362;&#x624B;&#x7387;</td>
</tr>
</tbody>
</table>
<h2 id="&#x56E0;&#x5B50;&#x6D4B;&#x8BD5;">&#x56E0;&#x5B50;&#x6D4B;&#x8BD5;</h2>
<p>Quant_Share&#x96C6;&#x6210;&#x4E86;&#x56E0;&#x5B50;&#x6D4B;&#x8BD5;&#x677F;&#x5757;&#xFF0C;&#x76EE;&#x524D;&#x4EC5;&#x6709;ICIR&#x8BA1;&#x7B97;&#x53CA;&#x7ED8;&#x56FE;&#xFF0C;&#x540E;&#x7EED;&#x5C06;&#x6269;&#x5145;</p>
<p>&#x53EF;&#x4F7F;&#x7528;<code>from Quant_Share import FactorTest</code>&#x5BFC;&#x5165;&#xFF0C;&#x4E0B;&#x9762;&#x5C55;&#x793A;&#x4E00;&#x4E2A;&#x793A;&#x4F8B;</p>
<h3 id="&#x6A21;&#x5757;&#x8C03;&#x7528;">&#x6A21;&#x5757;&#x8C03;&#x7528;</h3>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> matplotlib.pyplot <span class="hljs-keyword">as</span> plt
<span class="hljs-keyword">import</span> matplotlib.ticker <span class="hljs-keyword">as</span> ticker
<span class="hljs-keyword">from</span> Quant_Share <span class="hljs-keyword">import</span> get_data, reindex, FactorTest, info_lag, data2score
</code></pre>
<h3 id="&#x51C6;&#x5907;&#x56E0;&#x5B50;&#x6570;&#x636E;">&#x51C6;&#x5907;&#x56E0;&#x5B50;&#x6570;&#x636E;</h3>
<pre><code># score prepare
data = get_data(&apos;HKshszHold&apos;, begin=&apos;20200101&apos;, end=&apos;20221231&apos;)
data = data.pivot(index=&apos;endDate&apos;, columns=&apos;ticker&apos;, values=&apos;partyPct&apos;)
data = reindex(data.pct_change(periods=5, axis=0))
score = info_lag(data2score(data), n_lag=1)  # do not use future info
</code></pre><h3 id="&#x8BA1;&#x7B97;icir&#x5E76;&#x7ED8;&#x56FE;">&#x8BA1;&#x7B97;ICIR&#x5E76;&#x7ED8;&#x56FE;</h3>
<pre><code class="lang-python"><span class="hljs-comment"># Calc ICIR</span>
FTClass = FactorTest(beginDate=<span class="hljs-string">&apos;20200101&apos;</span>, endDate=<span class="hljs-string">&apos;20221231&apos;</span>)
rankIC, IR = FTClass.calc_IC(score)
fig, axis = plt.subplots()
axis.bar(rankIC.index, rankIC[<span class="hljs-string">&apos;rankIC&apos;</span>], width=<span class="hljs-number">1</span>, edgecolor=<span class="hljs-string">&quot;blue&quot;</span>, linewidth=<span class="hljs-number">0.8</span>)
axis.set_title(<span class="hljs-string">&quot;IR : {:.4f}&quot;</span>.format(IR.values[<span class="hljs-number">0</span>]))
axis.xaxis.set_major_locator(ticker.MultipleLocator(int(len(rankIC) / <span class="hljs-number">5</span>)))
fig.show()
</code></pre>
<p><img src="https://euclid-picgo.oss-cn-shenzhen.aliyuncs.com/image/202304221137379.png" alt="image-20230422113759245"></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="./" class="navigation navigation-prev " aria-label="Previous page: Introduction">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="函数及常量.html" class="navigation navigation-next " aria-label="Next page: 函数及常量">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"快速使用","level":"1.2","depth":1,"next":{"title":"函数及常量","level":"1.3","depth":1,"path":"函数及常量.md","ref":"函数及常量.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"快速使用.md","mtime":"2023-04-22T03:38:03.168Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-07-01T05:15:14.464Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

